package com.runvp.service.biz.service.impl;

import java.util.List;
import com.runvp.common.utils.DateUtils;
import com.runvp.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.runvp.service.biz.mapper.BizGoodsCategoryMapper;
import com.runvp.service.biz.domain.BizGoodsCategory;
import com.runvp.service.biz.service.IBizGoodsCategoryService;
import com.runvp.common.core.text.Convert;

/**
 * 商品分类Service业务层处理
 * 
 * @author runvp
 * @date 2022-09-18
 */
@Service
public class BizGoodsCategoryServiceImpl implements IBizGoodsCategoryService {
    @Autowired
    private BizGoodsCategoryMapper bizGoodsCategoryMapper;

    /**
     * 查询商品分类
     * 
     * @param id 商品分类主键
     * @return 商品分类
     */
    @Override
    public BizGoodsCategory selectBizGoodsCategoryById(Long id) {
        return bizGoodsCategoryMapper.selectBizGoodsCategoryById(id);
    }

    /**
     * 查询商品分类列表
     * 
     * @param bizGoodsCategory 商品分类
     * @return 商品分类
     */
    @Override
    public List<BizGoodsCategory> selectBizGoodsCategoryList(BizGoodsCategory bizGoodsCategory) {
        return bizGoodsCategoryMapper.selectBizGoodsCategoryList(bizGoodsCategory);
    }

    /**
     * 新增商品分类
     * 
     * @param bizGoodsCategory 商品分类
     * @return 结果
     */
    @Override
    public int insertBizGoodsCategory(BizGoodsCategory bizGoodsCategory) {
        bizGoodsCategory.setCreateTime(DateUtils.getNowDate());
        bizGoodsCategory.setCreateBy(ShiroUtils.getLoginName());
        return bizGoodsCategoryMapper.insertBizGoodsCategory(bizGoodsCategory);
    }

    /**
     * 修改商品分类
     * 
     * @param bizGoodsCategory 商品分类
     * @return 结果
     */
    @Override
    public int updateBizGoodsCategory(BizGoodsCategory bizGoodsCategory) {
        bizGoodsCategory.setUpdateTime(DateUtils.getNowDate());
        bizGoodsCategory.setUpdateBy(ShiroUtils.getLoginName());
        return bizGoodsCategoryMapper.updateBizGoodsCategory(bizGoodsCategory);
    }

    /**
     * 批量删除商品分类
     * 
     * @param ids 需要删除的商品分类主键
     * @return 结果
     */
    @Override
    public int deleteBizGoodsCategoryByIds(String ids) {
        return bizGoodsCategoryMapper.deleteBizGoodsCategoryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商品分类信息
     * 
     * @param id 商品分类主键
     * @return 结果
     */
    @Override
    public int deleteBizGoodsCategoryById(Long id) {
        return bizGoodsCategoryMapper.deleteBizGoodsCategoryById(id);
    }
}
